<% @page_title = l('pages').capitalize %>


<div id="main">
  <h2><%= l('Creating a new article') %></h2>

  <% unless @article.errors.empty? -%>
    <div id="ErrorExplanation">
      <h2><%= l("something gone wrong") %></h2>
      <ul>
      <% @article.errors.each do |attr, msg| -%>
        <li><%=h l(attr.capitalize) %> <%= l(msg) %></li>
      <% end -%>
      </ul>
    </div>
    <div class="clear"></div>
  <% end -%>

  <%= form_tag :action => :new, :category_id => @current_category %>
  <div>
    <label for="category-selection"><%= l('Category') %></label>
    <select name="article[category_id]" id="category-selection">
      <%= options_from_collection_for_select category_struct, 'id', 'name', selected_value = @current_category %>
    </select>
  </div>
  <div>
    <label for="article_title"><%= l('Title') %><em class="required">*</em></label>
    <%= text_field :article, :title %>
  </div>
  <div>
    <label for="article_author"><%= l('Author') %></label>
    <%= text_field :article, :author %>
  </div>
  <div id="excerpt">
    <label for="article_excerpt"><%= l('Excerpt') %></label>
    <%= text_area :article, :excerpt, :cols => 60, :rows => 5 %>
  </div>
  <div>
    <label for="article_body"><%= l('Body') %></label>
    <%= text_area :article, :body, :cols => 60, :rows => 20 %>
  </div>
  <div>
    <%= submit_tag l('validate'), :class => "button" %>
    <%= link_to l('cancel'), last_request_uri %>
  </div>
  </form>

</div>

<div id="sidebar">

  <div class="clear"></div>
  <p id="syntax-guide-toogle"><%= l("Open the %s to know how to make headers, lists, and more.", link_to_remote(l('syntax guide'), :url => { :action => :show_syntax_guide },
    :loading => "Element.show('load-indicator');",
    :complete => "Element.hide('load-indicator');Element.hide('syntax-guide-toogle');")) %></p>
</div>
